﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RRHH.Entities;
using System.Data.SqlClient;
using System.Data;

namespace RRHH.DataAccess
{
    public class DAOCargo
    {

        public List<BECargo> ListarCargo()
        {

            string sql = "SP_LISTAR_CARGO";

            SqlCommand sqlCommand = new SqlCommand();
            sqlCommand.CommandText = sql;

            using (DataAccess adoDataService = new DataAccess())
            {

                List<BECargo> _BLCargo = new List<BECargo>();
                IDataReader dr = adoDataService.ExecuteReader(sqlCommand);

                while (dr.Read())
                {
                    BECargo _BECargo = new BECargo();
                    _BECargo.idAuto = Convert.ToInt32(dr["IDAUTO"]);
                    _BECargo.descripcion = Convert.ToString(dr["DESCRIPCION"]);
                    _BECargo.estado = Convert.ToString(dr["ESTADO"]);
                    _BLCargo.Add(_BECargo);
                }
                dr.Close();

                adoDataService.Dispose();

                return _BLCargo;
            }

        }
    }
}
